<template>
  <div class="c-bg-white">
    <div class="c-w100 c-hh80 c-flex-row c-aligni-center c-bg-sgray c-ph30 c-fs22 c-fc-sblack">请选择违规内容出现在何处：</div>
    <div
      class="c-flex-row c-aligni-center c-justify-sb c-w100 c-hh96 c-pl30 c-pr24"
      v-for="(item, index) in listArray"
      @click="handleClickSelect(item, index)"
      :key="index"
    >
      <span class="c-fs26 c-fc-xblack">{{item.title}}</span>
      <span class="iconfont c-fs26 c-fc-sgray" v-show="item.isChecked == false">&#xe797;</span>
      <span class="iconfont c-fs26 theme-fc" v-show="item.isChecked == true">&#xe6b1;</span>
    </div>
    <div class="c-pf c-p-b0 c-w100 c-maxw640 c-hh124 c-bg-white c-ph24 c-flex-row c-justify-center c-aligni-center">
      <div
        class="c-fs28 c-fc-white theme-bg-gradient c-w100 c-hh64 c-br30 c-flex-row c-justify-center c-aligni-center c-opacity100"
        @click="handleClickReportDetail()"
      >下一步</div>
    </div>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js";
export default {
  name: "ReportCon",
  data() {
    return {
      listArray: [{
        title: "视频",
        isChecked: false,
        reportFrom: 1
      }, {
        title: "直播",
        isChecked: false,
        reportFrom: 2
      }, {
        title: "头像/昵称/背景图/个人介绍",
        isChecked: false,
        reportFrom: 3
      }, {
        title: "群聊",
        isChecked: false,
        reportFrom: 4
      }, {
        title: "课程评论",
        isChecked: false,
        reportFrom: 5
      }, {
        title: "直播评论",
        isChecked: false,
        reportFrom: 6
      }, {
        title: "其他",
        isChecked: false,
        reportFrom: 7
      }],
      reportType: "",
      reportFrom: ""
    }
  },
  created() {
    utilJs.appShare(this);
  },
  activated() {
    setDocumentTitle("用户举报");
    this.$store.commit('updateLoadingStatus', {
      isLoading: false
    });
    this.reportType = this.$route.query.reportType || "";
  },
  methods: {
    handleClickReportDetail() {
      if (this.reportFrom == "" || this.reportType == "") {
        this.$showCjToast({
          text: "请选择违规内容出现在何处",
          type: "warn",
        });
        return true;
      }
      this.$routerGo(this, "push", {
        path: "/homePage/report/reportDetail",
        query: {
          reportType: this.reportType,
          reportFrom: this.reportFrom
        }
      })
    },
    handleClickSelect(item, index) {
      this.reportFrom = item.reportFrom;
      this.listArray.forEach((item, i) => {
        this.$set(this.listArray[i], 'isChecked', false);
      })
      this.$set(this.listArray[index], 'isChecked', true);
    },
    //手机端分享
    appShare: function () {
      let title = window.localStorage.getItem("shareTitle");
      let shareImg = window.localStorage.getItem("shareLogo");
      let shareUrl = `${window.location.href.split("#")[0]}#?refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = '点击查看详情';
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    }
  }
}
</script>

<style lang="less" scoped>
</style>